//
//  RightCell.m
//  TinyFortune
//
//  Created by lc on 16/6/6.
//  Copyright © 2016年 lc. All rights reserved.
//

#import "RightCell.h"
#import "comModel.h"




@implementation RightCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setMessage:(AVIMMessage *)message{
    _message = message ;
    self.messageSenderClientId = message.clientId ;
    
}

- (void)layoutSubviews{
    CGFloat margin = 20 ;
    CGRect rightLabel = [self.rightLabel.text boundingRectWithSize:CGSizeMake(LC_WIDTH - 150, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil];
    
    self.rightLabel.frame = CGRectMake(_rightLabel.frame.origin.x, _rightLabel.frame.origin.y, rightLabel.size.width, rightLabel.size.height);
    UIImage *image = [UIImage imageNamed:@"SenderVoiceNodeDownloading"];
    image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(28, 32, 28, 32) resizingMode:UIImageResizingModeStretch];
    self.rightBubble.image = image;
    
   
    self.rightBubbleHeight.constant = rightLabel.size.height + margin + 5 ;
    self.rightBubleWidth.constant = rightLabel.size.width + margin * 2 + 5;
  
    
}
- (void)setModel:(comModel *)model{
    _model = model ;
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:_model.icon]];
    self.rightLabel.text = _model.text;
    NSLog(@"%@",_model.text);
}

@end
